<template>
  <div class="permission-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>角色权限管理</span>
          <el-button type="primary" @click="handleAddRole">添加角色</el-button>
        </div>
      </template>
      
      <el-table :data="roleData" style="width: 100%">
        <el-table-column prop="id" label="ID" width="80" />
        <el-table-column prop="name" label="角色名称" />
        <el-table-column prop="description" label="描述" />
        <el-table-column label="操作" width="250">
          <template #default="scope">
            <el-button size="small" @click="handleSetPermission(scope.row)">设置权限</el-button>
            <el-button size="small" @click="handleEditRole(scope.row)">编辑</el-button>
            <el-button size="small" type="danger" @click="handleDeleteRole(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const roleData = ref([
  {
    id: 1,
    name: '超级管理员',
    description: '系统最高权限'
  },
  {
    id: 2,
    name: '普通管理员',
    description: '基础管理权限'
  },
  {
    id: 3,
    name: '普通用户',
    description: '基础用户权限'
  }
])

const handleAddRole = () => {
  // 添加角色逻辑
}

const handleSetPermission = (row) => {
  // 设置权限逻辑
}

const handleEditRole = (row) => {
  // 编辑角色逻辑
}

const handleDeleteRole = (row) => {
  // 删除角色逻辑
}
</script>

<style scoped>
.permission-container {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style> 